import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import { basicRoutes } from './routes'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/dashboard'
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    },
    ...basicRoutes,
    {
      path: '/reset-pwd',
      meta: {
        title: '重置密码',
        noAuth: true
      },
      component: () => import(/* webpackChunkName: "reset-pwd" */ '../views/pages/reset-pwd.vue')
    },
    {
      path: '/403',
      meta: {
        title: '没有权限',
        noAuth: true
      },
      component: () => import(/* webpackChunkName: "403" */ '../views/pages/403.vue')
    },
    {
      path: '/404',
      meta: {
        title: '找不到页面',
        noAuth: true
      },
      component: () => import(/* webpackChunkName: "404" */ '../views/pages/404.vue')
    },
    { path: '/:path(.*)', redirect: '/404' }
  ]
})

export default router
